<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            margin: 0;
            padding: 0;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
            position: absolute;
        }

        ul li {
            width: 300px;
            height: 300px;
        }

        ul li:first-child {
            background: red;
        }

        ul li:last-child {
            background: blue;
            /* 绝对定位 父级没有定位,把浏览器当做观测点*/
            /* 会拖标 */
            position: absolute;
            top: 100px;
            left: 300px;
        }
    </style>
</head>

<body>
    <h1>祖先元素有定位，会相当于最近的有定位的祖先元素进行偏移</h1>
    <ul>
        <li></li>
        <li></li>
    </ul>

</body>

</html>